/**
 * setStorage 存储
 * getStorage 取到
 * removeStorage 移除
 */
export const BRStorage = {
    setStorage: (nameKey, val) => {
        try {
            const obj = JSON.stringify(val);
            localStorage.setItem(nameKey, obj);
        } catch (e) {
            localStorage.setItem(nameKey, val);
        }
    },
    getStorage: (nameKey) => {
        let str = localStorage.getItem(nameKey);
        if (str) {
            try {
                const obj = JSON.parse(str);
                return obj;
            } catch (e) {
                return str;
            }
        } else {
            return null;
        }
    },
    removeStorage: (nameKey) => {
        localStorage.removeItem(nameKey)
    },

    KeyUserToken: () => {
        return "BR_USER_TOKEN";
    },
    KeyGameID: () => {
        return "BR_GAME_ID";
    },
    KeyChannelCode: () => {
        return "BR_CHANNEL_CODE";
    },
    KeyRunRomSystem: () => {
        return "BR_RUN_ROM_SYSTEM";
    },
    KeyBRSDKVersionCode: () => {
        return "BR_SDK_VERSION_CODE";
    },
    KeyBRGameServerId: () => {
        return "BR_SDK_GAME_SERVER_ID";
    },
    KeyBRGameRoleId: () => {
        return "BR_SDK_GAME_ROLE_ID";
    },
    KeyBRPlatformCoin: () => {
        return "BR_SDK_PLATFORM_COIN";
    },
    KeyBRLoginName: () => {
        return "BR_SDK_LOGIN_NAME";
    },

}


